package edu.gdkm.demo8;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class FileDemo2 {
    public static void main(String[] args) throws IOException {
        File file = new File("./ershidabaogao.txt");
        FileReader fr = new FileReader(file);
        int count=0;
        while (true){
            int i=fr.read();
            if(i ==-1){
                break;
            }else{
                System.out.print((char)i);
                if((char)i=='中'){
                    count++;
                }
            }
        }
        System.out.println();
        System.out.println("报告中，'中'字一共出现了"+count+"次");
    }
}
